#My first Markdown document!

Here we can add some text if we want!

#because of eval=T we will get attain results

2+3
## [1] 5

#eval=T, so it will give answer, but if we add False so it will not give answer

2+3

Using proper packages: imageRy package has been built at Alma Mater for learning.

library (imageRy)

Let’s import same data, by listing them in imageRy

library (imageRy)
im.list()
##  [1] "dolansprings_oli_2013088_canyon_lrg.jpg"           
##  [2] "EN_01.png"                                         
##  [3] "EN_02.png"                                         
##  [4] "EN_03.png"                                         
##  [5] "EN_04.png"                                         
##  [6] "EN_05.png"                                         
##  [7] "EN_06.png"                                         
##  [8] "EN_07.png"                                         
##  [9] "EN_08.png"                                         
## [10] "EN_09.png"                                         
## [11] "EN_10.png"                                         
## [12] "EN_11.png"                                         
## [13] "EN_12.png"                                         
## [14] "EN_13.png"                                         
## [15] "greenland.2000.tif"                                
## [16] "greenland.2005.tif"                                
## [17] "greenland.2010.tif"                                
## [18] "greenland.2015.tif"                                
## [19] "info.md"                                           
## [20] "iss063e039892_lrg.jpg"                             
## [21] "matogrosso_ast_2006209_lrg.jpg"                    
## [22] "matogrosso_l5_1992219_lrg.jpg"                     
## [23] "sentinel.dolomites.b2.tif"                         
## [24] "sentinel.dolomites.b3.tif"                         
## [25] "sentinel.dolomites.b4.tif"                         
## [26] "sentinel.dolomites.b8.tif"                         
## [27] "sentinel.png"                                      
## [28] "Solar_Orbiter_s_first_views_of_the_Sun_pillars.jpg"

Importing the mato grosso area image:

library (imageRy)
mato1992<- im.import("matogrosso_l5_1992219_lrg.jpg")
## Warning: [rast] unknown extent

Importing the mato grosso area image, without warning:

library (imageRy)
mato1992<- im.import("matogrosso_l5_1992219_lrg.jpg")

In order to get info on the image, just type the name of the object:

mato1992
## class       : SpatRaster 
## dimensions  : 1500, 1200, 3  (nrow, ncol, nlyr)
## resolution  : 1, 1  (x, y)
## extent      : 0, 1200, 0, 1500  (xmin, xmax, ymin, ymax)
## coord. ref. :  
## source      : matogrosso_l5_1992219_lrg.jpg 
## colors RGB  : 1, 2, 3 
## names       : matogrosso~2219_lrg_1, matogrosso~2219_lrg_2, matogrosso~2219_lrg_3

#exercise: Making new plot of mato grosso area with the NIR on top of the green component of the RGB space:

im.plotRGB(mato1992, r=2, g=1, b=3)

Plotting saveral images all together:

par(mfrow=c(2,2))
im.plotRGB(mato1992, r=2, g=1, b=3)
im.plotRGB(mato1992, r=1, g=2, b=3)
im.plotRGB(mato1992, r=3, g=2, b=1)
im.plotRGB(mato1992, r=1, g=3, b=1)

calculating spectral indices:

dvi <- mato1992[[1]]-mato1992[[2]]
dvi
## class       : SpatRaster 
## dimensions  : 1500, 1200, 1  (nrow, ncol, nlyr)
## resolution  : 1, 1  (x, y)
## extent      : 0, 1200, 0, 1500  (xmin, xmax, ymin, ymax)
## coord. ref. :  
## source(s)   : memory
## varname     : matogrosso_l5_1992219_lrg 
## name        : matogrosso_l5_1992219_lrg_1 
## min value   :                        -246 
## max value   :                         255

calculating spectral indices:

library(terra)
## terra 1.7.55
library(viridis)
## Warning: package 'viridis' was built under R version 4.3.2
## Loading required package: viridisLite
dvi <- mato1992[[1]]-mato1992[[2]]
viridisc<- colorRampPalette(viridis(7)) (255)
plot(dvi, col=viridisc)